//////////////////////////////////////////////////////////////////////
//  Jack McCaffery
//  11-10-2014
//////////////////////////////////////////////////////////////////////

#pragma once

#include <vector>


/// \brief Small struct to keep individual changes of the state of a matrix
///	   during sampling
struct SingleSample
{
	~SingleSample ();
	SingleSample ();

	/// \brief Row to change value of
	unsigned row;
	/// \brief Column to change value of
	unsigned col;

	/// \brief The old value if you want to check that you're flipping
	///	   the correct spot
	double oldValue;
	/// \brief The value to change to
	double newValue;

	/// \brief The relative probability of the state before applying
	///	   the sample and after applying it. Slightly unsafe.
	double probability;

	/// \brief The relative log probability of the state before
	///	   applying the sample and after applying it. Slightly unsafe.
	double logProbability;
};


/// \brief Helper class to store several single changes to a matrix
class Sample
{
public:
	~Sample ();
	Sample ();

	/// \brief Get the total transition probability
	double transProbability () const;

	/// \brief Get the total transition log probability
	double transLogProbability () const;

	/// \brief Add a single sample to the total transition
	/// \param s_ The single sample to add to the complete transition
	void addSample (SingleSample const &s_);

	/// \brief Get the samples to look at in detail
	std::vector<SingleSample> const &getSamples () const;

private:
	/// \brief All the sample points
	std::vector<SingleSample> samplePoints;
};
